import { _decorator, Component, Node, Prefab } from "cc";
const { ccclass, property } = _decorator;

@ccclass("Bullet")
export class Bullet extends Component {
  @property
  public speed: number = 500;

  start() {}

  update(deltaTime: number) {
    const position = this.node.position;

    this.node.setPosition(
      position.x,
      position.y + this.speed * deltaTime,
      position.z
    );
    if (this.node.position.y > 440) {
      this.node.destroy();
    }
  }
}
